# Maintainer:  Anatol Pomozov <anatol@archlinux.org>

pkgname=virglrenderer
pkgver=0.10.4
pkgrel=1
pkgdesc='A virtual 3D GPU library, that allows the guest operating system to use the host GPU to accelerate 3D rendering'
arch=(loong64 x86_64)
url='https://virgil3d.github.io/'
license=(MIT)
depends=(libepoxy mesa libva)
makedepends=(python meson ninja)
checkdepends=(check)
_tag=virglrenderer-$pkgver
source=(virglrenderer-$pkgver.tar.bz2::https://gitlab.freedesktop.org/virgl/virglrenderer/-/archive/$_tag/virglrenderer-$_tag.tar.bz2)
sha256sums=('aaabe7928dac3786dd9bdf85d0f5630d6e45b222f99375007e33d24ea1beef77')

build() {
  cd virglrenderer-$_tag
  meson --prefix=/usr build -Dvideo=true # -Dtests=true
  ninja -C build
}

check() {
  cd virglrenderer-$_tag
  #ninja -C build test  TODO: figure out why tests fail in chroot environment
}

package() {
  cd virglrenderer-$_tag
  DESTDIR="$pkgdir" ninja -C build install
  install -D -m644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
